/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.upc.dew.sisrest.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import pe.edu.upc.dew.sisrest.model.Receta;
import pe.edu.upc.dew.sisrest.service.RecetaManager;

/**
 *
 * @author aldo
 */
@Controller
public class RecetaController {

    RecetaManager recetaManager;

    @Autowired
    public RecetaController(RecetaManager oRecetaManager) {
        this.recetaManager = oRecetaManager;
    }

    @RequestMapping("/adm_recetas.htm")
    public void adm_recetas(Model model, @ModelAttribute("Receta") Receta receta) {
        List<Receta> recetas = recetaManager.obtenerRecetas();
        model.addAttribute("recetas", recetas);
        model.addAttribute("receta", receta);
    }
}
